<%@ page import="com.ydgk.bean.Supplier" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: zzz
  Date: 2019/10/8
  Time: 19:40
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>suppliers</title>
    <link rel="stylesheet" type="text/css" href="css/suppliers.css">
</head>
<body>
<%
    List<Supplier> supplierlist = (List<Supplier>)request.getAttribute("supplierlist");
    int pageNumber = (int)request.getAttribute("page");
    int maxPage = (int)request.getAttribute("maxPage");
    int prev = pageNumber-1;
    int next = pageNumber+1;
%>
<div id="main">
    <p id="add"><a href="suppliersave.jsp" target="mainFrame">添加供应商</a></p>
    <table border="1">
        <tr style="color: snow;">
            <td>供应商编号</td>
            <td>供应商名字</td>
            <td>供应商地址</td>
            <td>供应商电话</td>
            <td colspan='2' align='center'>操作</td>
        </tr>
        <%for (int i = 0 ; i<supplierlist.size() ;i++){%>
        <tr style="color: cornsilk;">
            <td><%= supplierlist.get(i).getSid()%></td>
            <td><%= supplierlist.get(i).getSname()%></td>
            <td><%= supplierlist.get(i).getSaddress()%></td>
            <td><%= supplierlist.get(i).getStel()%></td>
            <td><a href='SupplierFindByIdServlet.action?sid=<%= supplierlist.get(i).getSid()%>&pageNumber=<%=pageNumber%>'>修改</a></td>
            <td><a href='SupplierDeleteServlet.action?sid=<%= supplierlist.get(i).getSid()%>&pageNumber=<%=pageNumber%>' target="mainFrame">删除</a></td>
        </tr>
        <%}%>
    </table>
    <div id="page">
        <a href="SupplierPagingServlet.action?pageNumber=1">首页</a>
        <a href="SupplierPagingServlet.action?pageNumber=<%out.print(prev>0?prev:1);%>">上一页</a>
        <font color="white"><%= "["+pageNumber+" / "+maxPage+"]"%></font>
        <a href="SupplierPagingServlet.action?pageNumber=<%out.print(next<=maxPage?next:maxPage);%>">下一页</a>
        <a href="SupplierPagingServlet.action?pageNumber=<%out.print(maxPage);%>">末页</a>
        <form action="SupplierPagingServlet.action"><input class="text" type="text" name="pageNumber" value="<%=pageNumber%>"><input class="button" type="submit" value="跳转"></form>
    </div>
</div>
</body>
<script src="js/jquery-2.1.1.min.js" type="text/javascript"></script>
<script>
    $(function () {
        $("#add a").mousedown(function () {
            $(this).css("font-size","14px");
        });
        $("#add a").mouseup(function () {
            $(this).css("font-size","16px");
        });
        $("a").not($("#add a")).hover(function(){
            $(this).css("color","darkmagenta");
        },function () {
            $(this).css("color","greenyellow");
        });
        $("table a").mousedown(function () {
            $(this).css("font-size","16px");
        });
        $("table a").mouseup(function () {
            $(this).css("font-size","21px");
        });
    });

</script>
</html>
